<template>
	<view class="adup-route-bz">
		<view class="my-fm" :style="{'padding-top': '0rpx'}">
			<view class="f-item no-box" :style="{'padding-top': '85rpx'}">
				<view class="f-item-title"
					:style="{'position': 'fixed', 'top': '-4rpx', 'width': 'calc(100% - 50rpx)', 'padding-left': '20rpx'}">
					<label class="r-l-icon" :style="{'background': '#ff6300', 'left': '0rpx'}"></label>
					行程师傅开支（元）
					<view class="r-r-con">
						<u-button :ripple="true" :hover-class="'none'" :custom-style="fm.sb.okBtnSty"
							:loading="fm.sb.load" @click="submitFm">
							<u-icon name="edit-pen-fill" color="#fff"></u-icon>提交
						</u-button>

						<u-button :hover-class="'none'" :custom-style="fm.sb.cancleBtnSy" @click="closeMd">
							<u-icon name="arrow-leftward" color="#ff6300"></u-icon>返回
						</u-button>
					</view>
				</view>

			</view>
			<view class="bz-fm">
				<u-collapse :accordion="false" ref="uCollspan">
					<u-collapse-item :title="'过路费'">
						<u-form :model="fm.ps.gljz" ref="gljzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">过路费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.gljz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入过路费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.gljz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">过路费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="gljzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.gljz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'打单费'">
						<u-form :model="fm.ps.ddjz" ref="ddjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">打单费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.ddjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入打单费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.ddjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">打单费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="ddjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.ddjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'生活费'">
						<u-form :model="fm.ps.shjz" ref="shjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">生活费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.shjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入生活费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.shjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">生活费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="shjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.shjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'住宿费'">
						<u-form :model="fm.ps.zsjz" ref="zsjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">住宿费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.zsjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入住宿费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.zsjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">住宿费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="zsjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.zsjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'买水费'">
						<u-form :model="fm.ps.msjz" ref="msjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">买水费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.msjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入买水费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.msjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">买水费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="msjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.msjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'洗车费'">
						<u-form :model="fm.ps.xcjz" ref="xcjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">洗车费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.xcjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入洗车费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.xcjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">洗车费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="xcjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.xcjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'停车费'">
						<u-form :model="fm.ps.tcjz" ref="tcjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">停车费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.tcjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入停车费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row">
											<view class="r-title">停车场下拉</view>
											<view class="r-con">
												<MySelect :title="'加油方式'" :name="'tcjz.tcWay'" :list="fm.tcWayList"
													:defval="fm.ps.tcjz.tcWay" @seledItem="mySeledMd"></MySelect>
											</view>
										</view>
									</u-form-item>
									<u-form-item v-if='fm.ps.tcjz.tcWay.val ==0'>
										<view class="i-row-textarea">
											<view class="r-title">停车场</view>
											<view class="r-con">
												<u-input v-model="fm.ps.tcjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="50"
													:placeholder="'请填写停车场，最多输入50个字'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">停车费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="tcjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.tcjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'打的费'">
						<u-form :model="fm.ps.dcjz" ref="dcjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">打的费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.dcjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入打的费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.dcjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">打的费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="dcjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.dcjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>
					<u-collapse-item :title="'其他费'">
						<u-form :model="fm.ps.qtjz" ref="qtjzfm">
							<view class="my-fm">
								<view class="f-item" :style="{'margin': '0rpx', 'padding': '0rpx'}">
									<u-form-item>
										<view class="i-row">
											<view class="r-title">其他费金额</view>
											<view class="r-con">
												<u-input v-model="fm.ps.qtjz.reimMoney" :type="'digit'" :maxlength="6"
													:input-align="'right'" :clearable="false"
													:custom-style="{'color': '#00C3CE'}"
													:placeholder="'请输入其他费金额'" /><label class="i-r-text">元</label>
											</view>
										</view>
									</u-form-item>
									<u-form-item>
										<view class="i-row-textarea">
											<view class="r-title">备注</view>
											<view class="r-con">
												<u-input v-model="fm.ps.qtjz.remark" :type="'textarea'"
													:custom-style="{'color': '#00C3CE'}"
													:placeholderStyle="'color: #f000000;'" :clearable="false"
													:auto-height="true" :height="150" :maxlength="200"
													:placeholder="'请填写备注，最多输入200个字（选填）'" />
											</view>
										</view>
									</u-form-item>
									<u-form-item :border-bottom="false">
										<view class="i-row-textarea">
											<view class="r-title">其他费凭证<label class="r-title-tip">（最多上传6张图片）</label>
											</view>
											<view class="r-con">
												<u-upload ref="qtjzUf" width="200" height="200" max-count="6"
													:file-list="fm.ps.qtjz.uflist" :action="fm.ufAction"
													:header="fm.ufHeader" :name="'file'"
													:form-data="{ftype: 'BACK_SET_DATA_IMG',}"
													:max-size="1024*1024*30"></u-upload>
											</view>
										</view>
									</u-form-item>
								</view>
							</view>
						</u-form>

					</u-collapse-item>

				</u-collapse>
			</view>
		</view>
	</view>
</template>

<script>
	import MySelect from '@/components/my-select/my-select.vue';
	export default {
		name: "adup-route-bz2",
		components: {
			MySelect,
		},
		data() {
			return {
				// 行程收支表单列表
				fmList: [],
				// 表单对象
				fm: {
					tcWayList: [],
					fname: 'routeBzFm',
					sb: {
						load: false,
						text: '添加',
						okBtnSty: {
							'background-color': '#00C3CE',
							'color': '#FFFFFF',
							'margin-left': '10rpx',
							'height': '66rpx',
							'font-size': '30rpx',
							'padding': '0 20rpx',
						},
						cancleBtnSy: {
							'color': '#ff6300',
							'margin-left': '10rpx',
							'height': '66rpx',
							'font-size': '30rpx',
							'padding': '0 20rpx',
						}
					},
					ps: {
						// 过路费
						gljz: {
							// 记账类型
							jzType: 'GLJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 打单费
						ddjz: {
							// 记账类型
							jzType: 'DDJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 生活费
						shjz: {
							// 记账类型
							jzType: 'SHJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 住宿费
						zsjz: {
							// 记账类型
							jzType: 'ZSJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 买水费
						msjz: {
							// 记账类型
							jzType: 'MSJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 洗车费
						xcjz: {
							// 记账类型
							jzType: 'XCJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 停车费
						tcjz: {
							// 记账类型
							jzType: 'TCJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 停车场
							tcWay: {
								val: '0',
								text: '自填'
							},
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 打的费
						dcjz: {
							// 记账类型
							jzType: 'DCJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},
						// 其他费
						qtjz: {
							// 记账类型
							jzType: 'QTJZ',
							id: '',
							reimMoney: '',
							reimVoucherUrl: "",
							moneyTypeId: "",
							remark: '',
							// 图片id
							fids: [],
							// 默认图片数组
							uflist: []
						},

					},
					// 文件上传地址
					ufAction: this.C.upfileUrl,
					// 文件上传请求头信息
					ufHeader: {
						'token': uni.getStorageSync(this.C.uuid)
					},
				},

				plateNum: '',
				id: '',
				orderNum: '',
			}
		},
		onLoad(e) {
			console.log(e)
			const that = this,
				U = that.U;
			// 备份一份空的表单数据，方便清空表单
			for (let a in that.fm.ps) {
				let f = U.scopy(that.fm.ps[a]);
				// 存在记账类型属性才验证
				if (f.jzType) that.fmList.push(f);
			}
			that.plateNum = e.plateNum
			that.id = e.id
			that.orderNum = e.orderNum
			let res = that.$u.api.getAllRouteMoneyTypes({});
			console.log('同步请求', res);
			that.$u.api.getParkingPlace({
				moneyTypeId: '18',
			}).then(res => {

				that.fm.tcWayList = [];
				let tcWayobj = {
					val: '0',
					text: '自填'
				}
				that.fm.tcWayList.push(tcWayobj)
				if (res.code == 1) {
					for (let i = 0; i < res.data.length; i++) {
						that.fm.tcWayList.push({
							val: i + 1,
							text: res.data[i]
						});
					}

				}
			})

			that.getOrderRouteBz(e.orderNum);
		},

		methods: {
			// 弹框列表选择
			mySeledMd(e) {
				console.log('父级接收子组件数据', e);
				const that = this,
					fm = that.fm.ps;

				that._.set(fm, e.name, e.obj);

				if (e.name == 'tcjz.tcWay') {
					that.$nextTick(function() {
						// 处理新增或者删除后的高度重置
						that.$refs.uCollspan.init();
					});
				}

				console.log('设置后的值', that.fm.ps);
			},
			// 获取-订单的报账记录
			getOrderRouteBz(orderNum) {
				let that = this,
					U = that.U,
					fm = that.fm.ps;
				that.$u.api.getOrderOfRouteBz({
					omsOrderNum: orderNum
				}).then(res => {
					if (res.code != 1 || (res.code == 1 && !res.data)) {
						// that.resetForm(); // 清空表单数据
						console.log(res)
					} else {
						console.log(res)
					}
				})

			},
			// 验证所有的表单
			valAllFm() {
				const that = this,
					U = that.U,
					FV = that.FV,
					fm = that.fm.ps,
					staffReimInfo = [];
				let fg = true,
					valFmList = [];

				if (fg) {
					for (let b = 0; b < that.fmList.length; b++) {

					}

					that.fmList.forEach(it => {
						// 当前记账类型表单参数对象名称
						let jzt = it.jzType.toLowerCase();
						// 当前记账表单参数对象
						let currfm = U.scopy(fm[jzt]);

						// 新表单对象与基类表单对象不同，表示新表单存在新参数
						if (!that._.isEqual(it, currfm)) valFmList.push(it.jzType);
					});


				}

				// 只要有一个表单存在新参数，就需要验证
				if (valFmList.length > 0) {
					// 验证过路费报账表单
					if (fg && valFmList.findIndex(it => it == fm.gljz.jzType) != -1) {
						let ps = U.scopy(fm.gljz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 12;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[过路费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[过路费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}
						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[停车场]最多填写50个字');
							} else {
								p.remark = remark;
							}
						}


						if (fg) {
							let uflist = that.$refs.gljzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张过路费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('过路费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}

					// 验证打单费报账表单
					if (fg && valFmList.findIndex(it => it == fm.ddjz.jzType) != -1) {
						let ps = U.scopy(fm.ddjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 13;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[打单费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[打单费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							console.log(fm, ps, ps.remark)
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[打单费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.ddjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张打单费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('打单费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}

					// 验证生活费报账表单
					if (fg && valFmList.findIndex(it => it == fm.shjz.jzType) != -1) {
						let ps = U.scopy(fm.shjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 14;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[生活费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[生活费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[生活费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.shjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张生活费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('生活费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}
					// 验证住宿费报账表单
					if (fg && valFmList.findIndex(it => it == fm.zsjz.jzType) != -1) {
						let ps = U.scopy(fm.zsjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 15;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[住宿费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[住宿费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[住宿费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.zsjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张住宿费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('住宿费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}
					// 验证买水费报账表单
					if (fg && valFmList.findIndex(it => it == fm.msjz.jzType) != -1) {
						let ps = U.scopy(fm.msjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 16;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[买水费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[买水费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[买水费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.msjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张买水费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('买水费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}
					// 验证洗车费报账表单
					if (fg && valFmList.findIndex(it => it == fm.xcjz.jzType) != -1) {
						let ps = U.scopy(fm.xcjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 17;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[洗车费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[洗车费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[洗车费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.xcjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张洗车费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('洗车费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}
					// 验证停车费报账表单
					if (fg && valFmList.findIndex(it => it == fm.tcjz.jzType) != -1) {
						let ps = U.scopy(fm.tcjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 18;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[停车费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[停车费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {

							let tcWay = ps.tcWay.val;
							if (tcWay != 0) {
								let remark = ps.tcWay.text;

								if (remark.length > 50) {
									fg = U.qinfo('[停车场]最多填写50个字');
								} else {
									p.remark = remark;
								}
							} else {
								if (fg) {
									let remark = ps.remark;
									if (remark.length > 50) {
										fg = U.qinfo('[停车场]最多填写50个字');
									} else {
										p.remark = remark;
									}
								}
							}
						}

						if (fg) {
							let uflist = that.$refs.tcjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张停车费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('停车费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}
					// 验证打的费报账表单
					if (fg && valFmList.findIndex(it => it == fm.dcjz.jzType) != -1) {
						let ps = U.scopy(fm.dcjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 20;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[打的费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[打的费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[打的费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.dcjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张打的费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('打的费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}
					// 验证其他费报账表单
					if (fg && valFmList.findIndex(it => it == fm.qtjz.jzType) != -1) {
						let ps = U.scopy(fm.qtjz),
							p = {};
						if (fg) {
							p.jzType = ps.jzType;
							p.moneyTypeId = 19;
							p.id = ps.id;
						}
						if (fg) {
							let reimMoney = ps.reimMoney;
							if (!reimMoney || reimMoney == 0) {
								fg = U.qinfo('[其他费金额]不能为空或0');
							} else if (!FV.isFloat(reimMoney)) {
								fg = U.qinfo('[其他费金额]格式错误');
							} else {
								p.reimMoney = reimMoney;
							}
						}

						if (fg) {
							let remark = ps.remark;
							if (remark.length > 200) {
								fg = U.qinfo('[其他费备注]最多填写200个字');
							} else {
								p.remark = remark;
							}
						}

						if (fg) {
							let uflist = that.$refs.qtjzUf.lists;
							if (uflist.length == 0) {
								fg = U.qinfo('至少需要上传一张其他费小票图片');
							} else {
								let fids = [];
								uflist.forEach(it => {
									if (it.response && it.response.data) fids.push(it.response.data.file.url);
								});

								console.log('其他费记账图片', uflist, fids);

								if (fids.length == 0) {
									fg = U.qinfo('上传图片' + uflist.length + '张，成功' + fids.length + '张');
								} else {
									p.reimVoucherUrl = fids.join(',');

									staffReimInfo.push(p);
								}
							}
						}

					}


				}








				if (valFmList.length == 0) fg = U.qinfo('至少需要提交一项报账');

				return fg ? {
					staffReimInfo: staffReimInfo
				} : fg;
			},
			// 表单提交
			submitFm() {
				let that = this,
					U = that.U;

				let ps = that.valAllFm();
				if (ps != false) {

					ps.plateNum = that.plateNum
					ps.omsOrderNum = that.orderNum
					console.log('提交所有表单参数', JSON.stringify(ps));
					that.$u.api.adupOrderRouteBz(ps).then((res) => {
						if (res.code != 1) {
							// U.qerror(res.msg);
							uni.showToast({
								title: res.msg,
								duration: 2000,
								icon: 'none',
							})
						} else {
							// console.log('结果', res);
							// U.qinfo(res.msg);
							uni.showToast({
								title: res.msg,
								duration: 2000,
								icon: 'none',
							})
							
							setTimeout(() => {
								// 循环重置表单
								that.fmList.forEach(it => {
									// 当前记账类型表单参数对象名称
									let jzt = it.jzType.toLowerCase();

									let jzType = that.fm.ps[jzt].jzType;
									if (jzType) {
										that.fm.ps[jzt] = U.scopy(it);



										// 清空对应文件
										that.$refs[jzt + 'Uf'].clear();
									}
								});
								// 返回上一页
								uni.navigateBack({
									delta: 1
								});
							}, 2000)
						}
					});
				}
			},

			// 关闭弹框
			closeMd() {
				// 返回上一页
				uni.navigateBack({
					delta: 1
				});
			},
		}
	}
</script>

<style lang="scss">
	// 非行程收支报账
	.bz-fm {
		background: #fff;
		margin: 10rpx;
		box-shadow: 0 2rpx 3rpx rgba(0, 0, 0, 0.1);
		border-radius: 10rpx;
		padding: 20rpx;
		padding-bottom: 120rpx;

		.u-collapse-item {
			border-bottom: 1rpx solid #a6eaea;

			.u-collapse-head {
				font-size: 40rpx;
				color: #333;
				font-weight: 600;

				.u-collapse-title {
					border-left: 8rpx solid #00c3c3;
					padding-left: 10rpx;
				}
			}

		}

	}
</style>